<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{    
    protected function _initViewHelpers()
    {
        
        $this->bootstrap('layout');
        $layout = $this->getResource('layout');

        $view = $layout->getView();
        $view->doctype('HTML5'); // http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.doctype
        $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
        $view->headTitle('Memorygame')->setSeparator(' - ');
        $view->headLink()->appendStylesheet($this->stylesBase . 'http://fonts.googleapis.com/css?family=Eater');
        
        //$view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper");
    }
    
    /**
     * Initialiseer de Navigation View Helper
     */
    protected function _initNavigationViewHelper()
    {
        $xml = APPLICATION_PATH . '/configs/navigation.xml';
        $pages = new Zend_Config_Xml($xml);
        $navigation = new Zend_Navigation($pages);
        $storage = Zend_Auth::getInstance()->getStorage()->read();
        $role = (isset ($storage->user_role) ) ?  $storage->user_role : 'guest';        
        
        $view = $this->_getView();
        $view->navigation($navigation)
             ->setAcl( new Ahs_Acl() )
             ->setRole($role); 
    }
    
     /**
     * @param string $resource
     * @return Zend_View
     */
    protected function _getView($resource = 'layout')
    {
        $this->bootstrap($resource);
        $layout = $this->getResource($resource);
        $view = $layout->getView();

        return $view;
        
    }

}
